<%@ page language="java" contentType="text/html;charset=utf-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->
<head>
    <jsp:include page="../common/common.jsp"/>
</head>
<body class="page-header-fixed">
<jsp:include page="../common/header.jsp"/>
<div class="clearfix">
</div>
<div class="page-container">
    <div class="page-sidebar-wrapper"><jsp:include page="../common/menu.jsp"/></div>
    <div class="page-content-wrapper">
        <div class="page-content">
            <div class="row">
                <div class="col-md-12">
                    <form class="form-horizontal form-row-seperated" id="form" method="post" action="${path}/productx/save">
                        <div class="portlet box purple">
                            <div class="portlet-title">
                                <div class="caption">
                                    <i class="fa fa-shopping-cart"></i>产品详细内容
                                </div>
                                <div class="actions btn-set">
                                    <a href="javascript:history.go(-1);" class="btn default"><i
                                            class="fa fa-angle-left"></i> 返回</a>
                                    <a href="javascript:location.reload();" class="btn green"><i
                                            class="fa fa-reply"></i> 重置</a>
                                    <button type="button" onclick="save()" class="btn blue"><i class="fa fa-check"></i> 保存
                                    </button>
                                
                                </div>
                            </div>
                            <div class="portlet-body">		<!-- 分页  -->
                                <div class="tabbable">
                                <ul class="nav nav-tabs" id="table">
										<li class="active">
											<a href="#tab_general" data-toggle="tab">
												文字信息
											</a>
										</li>
										<li>
											<a href="#tab_images" data-toggle="tab">
												 图片信息
											</a>
										</li>
									</ul>
                                    <div class="tab-content no-space">
                                        <div class="tab-pane active" id="tab_general">
                                            <div class="form-body">
                                            
                                                <div class="form-group">
                                                    <label class="col-md-2 control-label">产品名称:
                                                        <span class="required">*</span>
                                                    </label>

                                                    <div class="col-md-5">
                                                        <input type="text" id="title" name="title"
                                                               class="form-control measure-input" datatype="*1-80"
                                                               value="${data.title}"/>
                                                    </div>
                                                    <div class="col-md-5">
                                                        &nbsp;可输入<b><span id="title_len">80</span></b> 个字符
                                                    </div>
                                                    
                                           		   
                                                </div>
                                                
                                                <div class="form-group">
                                                    <label class="col-md-2 control-label">地区:
                                                        <span class="required">*</span>
                                                    </label>
                                                    <div class="col-md-2"  style="width: 190px;">
                                                        <select id="province" name="province" class="form-control"></select>
                                                    </div>
                                                    <div class="col-md-3"   style="width: 190px;">
                                                        <select id="city" name="city" class="form-control"></select>
                                                    </div>
                                                    <div class="col-md-3"  style="width: 190px;">
                                                        <select id="county" name="county" class="form-control"></select>
                                                    </div>
                                                    
                                                    <label class="col-md-2 control-label">卡类型（天数）-:
                                                    <span class="required">*</span>
                                                    </label>

                                                    <div class="col-md-2">
                                                              <input id="refund" name="refund" type="text"
                                                               class="form-control tags medium"
                                                               value="${data.refund}"/>
		                                         
                                                    </div>
                                                </div>
                                                
                                                <div class="form-group">
                                                   <label class="col-md-2 control-label">渠道价格:
                                                    <span class="required">*</span>
                                                    </label>

                                                    <div class="col-md-2">
                                                        <input id="price" name="price" type="text"
                                                               class="form-control tags medium"
                                                               value="${data.price}"/>
                                                    </div>
                                            
                                                    
                                                      <label class="col-md-2 control-label">折扣价:
                                                    <span class="required">*</span>
                                                    </label>

                                                    <div class="col-md-2">
                                                        <input id="reduceprice" name="reduceprice" type="text"
                                                               class="form-control tags medium"
                                                               value="${data.reduceprice}"/>
                                                    </div> 
                                                      <label class="col-md-2 control-label">补贴率（0.0）:
                                                    <span class="required">*</span>
                                                    </label>

                                                    <div class="col-md-2">
                                                        <input id="lv" name="lv" type="text"
                                                               class="form-control tags medium"
                                                               value="${data.lv}"/>
                                                    </div>
                                                </div>
                                                
                                                <div class="form-group">
                                                    <label class="col-md-2 control-label">入住时间:
                                                    <span class="required">*</span>
                                                    </label>

                                                    <div class="col-md-2">
                                                        <input id="rutime" name="rutime" type="text"
                                                               class="form-control tags medium"
                                                               value="${data.rutime}"/>
                                                    </div>
                                                                                               
                                                      <label class="col-md-2 control-label">退房时间:
                                                    <span class="required">*</span>
                                                    </label>

                                                    <div class="col-md-2">
                                                        <input id="tuitime" name="tuitime" type="text"
                                                               class="form-control tags medium"
                                                               value="${data.tuitime}"/>
                                                    </div> 
                                                      <label class="col-md-2 control-label">接待时间:
                                                    <span class="required">*</span>
                                                    </label>

                                                    <div class="col-md-2">
                                                        <input id="jietime" name="jietime" type="text"
                                                               class="form-control tags medium"
                                                               value="${data.jietime}"/>
                                                    </div>
                                                </div>
                                                
                                                     <div class="form-group">
                                                    <label class="col-md-2 control-label">几居:
                                                    <span class="required">*</span>
                                                    </label>

                                                    <div class="col-md-2">
                                                        <input id="houses" name="houses" type="text"
                                                               class="form-control tags medium"
                                                               value="${data.houses}"/>
                                                    </div>
                                                                                               
                                                      <label class="col-md-2 control-label">多少平方:
                                                    <span class="required">*</span>
                                                    </label>

                                                    <div class="col-md-2">
                                                        <input id="square" name="square" type="text"
                                                               class="form-control tags medium"
                                                               value="${data.square}"/>
                                                    </div> 
                                                      <label class="col-md-2 control-label">宜住几人:
                                                    <span class="required">*</span>
                                                    </label>

                                                    <div class="col-md-2">
                                                        <input id="yzrs" name="yzrs" type="text"
                                                               class="form-control tags medium"
                                                               value="${data.yzrs}"/>
                                                    </div>
                                                </div>
                                                
                                                  <div class="form-group">
                                                    <label class="col-md-2 control-label">使用方式:
                                                    <span class="required">*</span>
                                                    </label>
																
                                                    <div class="col-md-2">
                                                              <select name="isfb" class="form-control">
                                                            <option value="0" <c:if test="${0== data.isfb }">selected="selected" </c:if> >随时使用</option>
                                                        	<option value="1" <c:if test="${1== data.isfb }">selected="selected" </c:if> >到期使用</option>
                                                        </select>
                                                    </div>
                                                    
                                                  <label class="col-md-2 control-label">是否放在首页:
                                                    <span class="required">*</span>
                                                    </label>
																
                                                    <div class="col-md-2">
                                                              <select name="issy" class="form-control">
                                                            <option value="0" <c:if test="${0== data.issy }">selected="selected" </c:if> >否</option>
                                                        	<option value="1" <c:if test="${1== data.issy }">selected="selected" </c:if> >是</option>
                                                        </select>
                                                    </div> 
                                                    
                                                         
                                                    <label class="col-md-2 control-label">产品分类:
                                                    <span class="required">*</span>
                                                    </label>
                                                        <div class="col-md-2">
                                                              <select name="rmtype" class="form-control">
                                                            <option value="0" <c:if test="${0== data.rmtype }">selected="selected" </c:if> >养老基地</option>
                                                        	<option value="1" <c:if test="${1== data.rmtype }">selected="selected" </c:if> >热门预定</option>
                                                        	<option value="2" <c:if test="${2== data.rmtype }">selected="selected" </c:if> >新手预定</option>
                                                       	<option value="3" <c:if test="${3== data.rmtype }">selected="selected" </c:if> >候鸟旅居</option>
                                                        	<option value="4" <c:if test="${4== data.rmtype }">selected="selected" </c:if> >旅游</option>
                                                       	<option value="5" <c:if test="${5== data.rmtype }">selected="selected" </c:if> >理疗保健</option>
                                                        	<option value="6" <c:if test="${6== data.rmtype }">selected="selected" </c:if> >健康课程</option>
                                                              <option value="7" <c:if test="${7== data.rmtype }">selected="selected" </c:if> >养老保险</option>
                                                               	<option value="8" <c:if test="${3== data.rmtype }">selected="selected" </c:if> >健康食品</option>
                                                        	<option value="9" <c:if test="${9== data.rmtype }">selected="selected" </c:if> >营养健康</option>
                                                       	<option value="10" <c:if test="${10== data.rmtype }">selected="selected" </c:if> >美容护肤</option>
                                                        	<option value="11" <c:if test="${11== data.rmtype }">selected="selected" </c:if> >理疗仪器</option>
                                                              <option value="12" <c:if test="${12== data.rmtype }">selected="selected" </c:if> >减肥产品</option>
                                                        <option value="13" <c:if test="${13== data.rmtype }">selected="selected" </c:if> >生活用品</option>
                                                        <option value="14" <c:if test="${14== data.rmtype }">selected="selected" </c:if> >代理</option>
                                                       
                                                        </select>
                                                    </div>                                          
                                                
                                                </div>
                                                
                                                 <div class="form-group">
                                                    <label class="col-md-2 control-label">是否包含三餐:
                                                    <span class="required">*</span>
                                                    </label>
                                                    <div class="col-md-2">
                                                              <select name="iscoke" class="form-control">
                                                            <option value="0" <c:if test="${0== data.iscoke }">selected="selected" </c:if> >是</option>
                                                        	<option value="1" <c:if test="${1== data.iscoke }">selected="selected" </c:if> >否</option>
                                                        </select>
                                                    </div>
                                                    
                                                      <label class="col-md-2 control-label">是否包含早餐:
                                                    <span class="required">*</span>
                                                    </label>
                                                    <div class="col-md-2">
                                                              <select name="iszaocan" class="form-control">
                                                            <option value="0" <c:if test="${0== data.iszaocan }">selected="selected" </c:if> >是</option>
                                                        	<option value="1" <c:if test="${1== data.iszaocan }">selected="selected" </c:if> >否</option>
                                                        </select>
                                                    </div>
                                                </div>
                                                
                                           <div class="form-group">
                                                    <label class="col-md-2 control-label">是否代理产品:
                                                    <span class="required">*</span>
                                                    </label>
                                                    <div class="col-md-2">
                                                              <select name="ispktype"   onchange="opendxs(this)" class="form-control">
                                                            <option value="0" <c:if test="${0== data.ispktype }">selected="selected" </c:if> >否</option>
                                                        	<option value="1" <c:if test="${1== data.ispktype }">selected="selected" </c:if> >是</option>
                                                        </select>
                                                    </div>
                                                    
                                                    <div id="dxs"  <c:if test="${0== data.ispktype ||data.ispktype == null }">style="display: none;"</c:if>  >
                                                      <label class="col-md-2 control-label">代理类别:
                                                    <span class="required">*</span>
                                                    </label>
                                                    <div class="col-md-2">
                                                              <select name="isdlype" class="form-control"   onchange="opendxzzz(this)" >
                                                              <option value="-1" >请选择</option>
                                                            <option value="0" <c:if test="${0== data.isdlype }">selected="selected" </c:if> >298</option>
                                                        	<option value="1" <c:if test="${1== data.isdlype }">selected="selected" </c:if> >980</option>
                                                        </select>
                                                    </div>
                                                    </div>
                                                </div>
                                                
                                                
                                                
                                               <div class="form-group">
                                                <label class="col-md-2 control-label">产品有效时间<span class="required">*</span></label>
                                                
                                        			<div class="col-md-4">
                                            			<div class="input-group input-large date-picker input-daterange"
                                                 		data-date-format="yyyy-mm-dd">
                                                		<input type="text" class="form-control" id="produceBegin" name="produceBegin" value="${data.produceBegin}"
                                                       readonly="readonly" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"/>
                                                		<span class="input-group-addon">to</span>
                                                		<input type="text" class="form-control" id="produceEnd" name="produceEnd" value="${data.produceEnd}"
                                                       readonly="readonly" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"/>
                                            			</div>
                                        			</div>
                                        			<label class="col-md-2 control-label">状态:
                                                        <span class="required">*</span>
                                                    </label>
                                                    <div class="col-md-3">
                                                        <select name="status" class="form-control">
                                                            <option value="0" <c:if test="${0== data.status }">selected="selected" </c:if> >审核通过</option>
                                                        	<option value="1" <c:if test="${1== data.status }">selected="selected" </c:if> >已下架</option>
                                                        	<option value="2" <c:if test="${2== data.status }">selected="selected" </c:if> >审核中</option>
                                                        	<option value="3" <c:if test="${3== data.status }">selected="selected" </c:if> >审核不通过</option>
                                                        </select>
                                                    </div>
                                        		</div>
                                                <div class="form-group">
                                                    
                                                    <label class="col-md-2 control-label">支持:
                                                    </label>
                                                    <div class="col-md-3">										<!-- 使用jstl的fn:indexof判断字符串包含某个值，然后在页面上显示是否 checked-->
                                                   	    <c:forEach items="${typelist}" var="c">
															<input name="ptypename" type="checkbox" value="${c.value0}" 
															<c:if test="${fn:indexOf(data.ptypename, c.value0)!=-1}">checked</c:if>>
															${c.value0}
				                                                </c:forEach>
                                                    </div>
                                                    
                                                <!--        <label class="col-md-2 control-label">活动支持支持:
                                                    </label>
                                                    <div class="col-md-3">										<!-- 使用jstl的fn:indexof判断字符串包含某个值，然后在页面上显示是否 checked
                                                   	    <c:forEach items="${hdbqlist}" var="c">
															<input name="hdbiaoqname" type="checkbox" value="${c.value0}" 
															<c:if test="${fn:indexOf(data.hdbiaoqname, c.value0)!=-1}">checked</c:if>>
															${c.value0}
				                                                </c:forEach>
                                                    </div>		--> 		 
                                                </div>
                                             
                                                <div class="form-group">
                                                	<label class="col-md-2 control-label">商家ID:
                                                    <span class="required">*</span>
                                                    </label>

                                                    <div class="col-md-2">
                                                    	  <select   name="mallId"   id="mallId" class="form-control">
                                                    	    <c:forEach items="${mall}" var="c">
				                                                    <option value="${c.id}">${c.name}</option>
				                                                </c:forEach>
                                                        </select>
                                                    </div>
                                                    <label class="col-md-2 control-label">已售:
                                                    </label>

                                                    <div class="col-md-2">
                                                    	 
                                                        <input id="sku" name="sku" type="text"
                                                               class="form-control tags medium"
                                                               value="${data.sku}"/> 
                                                
                                                    </div>
                                                    
                                                          <label class="col-md-2 control-label">加补贴率（如果不加，请不填）:
                                                    </label>

                                                    <div class="col-md-2">
                                                    	 
                                                        <input id="sylv" name="sylv" type="text"
                                                               class="form-control tags medium"
                                                               value="${data.sylv}"/> 
                                                
                                                    </div>
												
                                                </div>
                                                
                                                <div class="form-group">
                                                <label class="col-md-2 control-label"> 期号:
                                                    <span class="required">*</span>
                                                    </label>

                                                    <div class="col-md-2">
                                                       	  <select name="qihao" class="form-control">
                                                    	    <c:forEach items="${qhlist}" var="c">
				                                                    <option   <c:if test="${c.value0== data.qihao }">selected="selected" </c:if>  value="${c.value0}">${c.value0}</option>
				                                                </c:forEach>
                                                        </select>
                                                    </div>
                                                
                                                	<label class="col-md-2 control-label"> 限量数量:
                                                    <span class="required">*</span>
                                                    </label>

                                                    <div class="col-md-2">
                                                    	   <input id="xl" name="xl" type="text"
                                                               class="form-control tags medium"
                                                               value="${data.xl}"/> 
                                                    </div>
                                                    
                                                    
                                                    <label class="col-md-2 control-label"> 多少起订:
                                                    </label>

                                                    <div class="col-md-2">
                                                        <input id="dsqd" name="dsqd" type="text"
                                                               class="form-control tags medium"
                                                               value="${data.dsqd}"/> 
                                                    </div>
                                                </div>
                                             
                                            
                                                <input type="hidden" name="author" class="form-control" value="admin"/>
                                                <input type="hidden" id="imgUrl" name="imgUrl" class="form-control"
                                                       value="${data.imgUrl}"/>
                                                
                                                <div class="form-group">
                                                <label class="col-md-2 control-label">封面：</label>

                                                <div class="col-md-8">
                                                    <div class="fileinput fileinput-new" data-provides="fileinput">
                                                        <div class="fileinput-new thumbnail" style="width: 300px; height: 150px;">
                                                            <img src="${data.imgUrl}">
                                                        </div>
                                                        <div class="fileinput-preview fileinput-exists thumbnail"
                                                             style="max-width: 300px; max-height: 150px;">
                                                        </div>
                                                        <div>
                                                            <span class="btn default btn-file">
                                                                <span class="fileinput-new">
                                                                     选择图片
                                                                </span>
                                                                <span class="fileinput-exists">
                                                                     修改图片
                                                                </span>
                                                                <input type="file" id="file" name="file"/>
                                                            </span>
                                                            <a href="#" class="btn default fileinput-exists"
                                                               data-dismiss="fileinput">
                                                                移除图片
                                                            </a>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>

                                      <!--           <div class="form-group">
                                                    <label class="col-md-2 control-label">产品简介:
                                                        <span class="required">*</span>
                                                    </label>

                                                    <div class="col-md-8">
                                                        <textarea cols="80" class="form-control" datatype="*"
                                                                  name="summary">${data.summary}</textarea>
                                                    </div>
                                                </div>--> 
                                                <div class="form-group">
                                                    <label class="col-md-2 control-label">产品描述:
                                                        <span class="required">*</span>
                                                    </label>
													  
                                                    <div class="col-md-8">
                                                        <%-- <jsp:include page="common/editor.jsp" /> --%>
                                                        <input id="context" type="hidden" name="context">
                                                        <script id="editor" type="text/plain"
                                                                style="height:500px;">${data.context}</script>
                                                    </div> 
                                                </div>
                                             
                                            </div>
                                        </div>
                                        <div class="tab-pane" id="tab_images"><!-- 图片div- -->
                                         
	                                           <div id="tab_images_uploader_container" class="text-align-reverse margin-bottom-10">
												<a id="tab_images_uploader_pickfiles" href="javascript:;" onClick="upImage()" class="btn yellow">
													<i class="fa fa-plus"></i> 上传图片
												</a>
												</div>
											
    											 
    											 
    												<div id="imgshow"></div>
											</div>
                                    </div>
                                </div>
                            </div>
					<script id="ueditorupload" type="text/plain" style="height:5px;display:none;" ></script>
                            <div class="portlet-title">
                                <div class="actions btn-set">
                                    <a href="javascript:history.go(-1);" class="btn default"><i
                                            class="fa fa-angle-left"></i> 返回</a>
                                    <a href="javascript:location.reload();" class="btn green"><i
                                            class="fa fa-reply"></i> 重置</a>
                                    <button type="button" onclick="save()" class="btn blue"><i class="fa fa-check"></i> 保存
                                    </button>
                              
                                </div>
                            </div>
                        </div>
                        
         
                       <input type="hidden" id="userid" name="userid" value="${data.userid}">
                         <input type="hidden" id="username" name="username" value="${data.username}">
                        <input type="hidden" id="id" name="id" value="${data.id}">
                        <input type="hidden" id="by1" name="by1"  value="${data.by1}"/>
                        <input type="hidden" id="productximg" name="productximg"  value="${data.productximg}"/>  
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<jsp:include page="../common/footer.jsp"/>
<script type="text/javascript" src="${path}/assets/plugins/bootstrap-fileinput/bootstrap-fileinput.js"></script>
<script type="text/javascript" src="${path}/assets/plugins/calendar/WdatePicker.js"></script>
<script type="text/javascript" src="${path}/assets/plugins/jquery-inputmask/jquery.inputmask.bundle.min.js"></script>
<script type="text/javascript" src="${path}/assets/plugins/jquery.input-ip-address-control-1.0.min.js"></script>
<script type="text/javascript" src="${path}/assets/plugins/jquery.pwstrength.bootstrap/src/pwstrength.js"></script>
<script type="text/javascript" src="${path}/assets/scripts/custom/components-form-tools.js"></script>
<script type="text/javascript" src="${path}/assets/scripts/biz/ajaxfileupload.js"></script>
<script type="text/javascript" src="${path}/assets/plugins/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="${path}/assets/plugins/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" src="${path}/assets/plugins/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" src="${path}/assets/plugins/district/linkagesel-min.js"></script>
<script type="text/javascript" src="${path}/assets/scripts/biz/jsAddress.js"></script>  <!-- 获取省、市、县数据 -->
<script type="text/javascript" src="${path}/operate/js/productxDetail.js"></script>

<script>
    var operType = '${operType}';
    var editor, form,o_ueditorupload;
    $(function () {
        $('#pid').change(function() {
            changeSecondType(this.value);
        });
  
        
        o_ueditorupload = UE.getEditor('ueditorupload', {
	        autoHeightEnabled:false,
	        catchRemoteImageEnable:false
	      });
	o_ueditorupload.ready(function ()  {
//	o_ueditorupload.hide();//隐藏编辑器
  //监听图片上传
  	o_ueditorupload.addListener('beforeInsertImage', function (t,arg){
	var srm="";
	for(var i in arg){
		$('#imgshow').append("<div class='imgs' sr='"+arg[i].src+"' ><img height=180' width='180'  src='"+arg[i].src+"'/><a  href='#' el='"+arg[i].src+"'  class='xle' onClick='dels(this)'><i class='fa fa-times'></i>删除</a></div>");
				if(srm==""){
					srm=arg[i].src;
				}else{
					srm+=","+arg[i].src;
				}
	}
	$("#productximg").val(srm);
});
 
  o_ueditorupload.addListener('afterUpfile', function (t, arg) {
    alert('这是文件地址：'+arg[0].url);
  });
});

        UE.getEditor('editor');
      	//省市级联
        addressInit('province', 'city', 'county', '湖北', '襄樊市', '襄城区');
        addressInit('Select1', 'Select2', 'Select3');
        $("#province").val('${data.province}').change();
        $("#city").val('${data.city}').change();
        $("#county").val('${data.county}').change();
        form = $("form").Validform({
            tiptype: function (msg, o, cssctl) {
                //msg：提示信息;
                //o:{obj:*,type:*,curform:*}, obj指向的是当前验证的表单元素（或表单对象），type指示提示的状态，值为1、2、3、4， 1：正在检测/提交数据，2：通过验证，3：验证失败，4：提示ignore状态, curform为当前form对象;
                //cssctl:内置的提示信息样式控制函数，该函数需传入两个参数：显示提示信息的对象 和 当前提示的状态（既形参o中的type）;
                if (!o.obj.is("form")) {//验证表单元素时o.obj为该表单元素，全部验证通过提交表单时o.obj为该表单对象;
                    var objtip = o.obj.siblings(".Validform_checktip");
                    cssctl(objtip, o.type);
                    objtip.text(msg);
                } else {
                    var objtip = o.obj.find("#msgdemo");
                    cssctl(objtip, o.type);
                    objtip.text(msg);
                }
            },
            postonce: true,
            showAllError: true,
            callback: function () {
                save();
            }
        });
    });
    
    function save() {
        var context = UE.getEditor('editor').getContent();
        if (!/[\w\W]+/.test(context)) {
            alert("内容不能为空");
            return;
        }
        $("#context").val(context);
        
        if ($("#pid").val()=='') {
            alert("产品分类不能为空");
            return;
        }
        if ($("#columnId").val()=='') {
            alert("二级分类不能为空");
            return;
        }
        if ($("#title").val()=='') {
            alert("产品名称不能为空");
            return;
        }
        if ($("#price").val()=='') {
            alert("价格不能为空");
            return;
        }
        if ($("#shopprice").val()=='') {
            alert("店铺价格不能为空");
            return;
        }
        if ($("#reduceprice").val()=='') {
            alert("新用户减价不能为空");
            return;
        }
        if ($("#produceBegin").val()=='') {
            alert("产品有效时间不能为空");
            return;
        }
        if ($("#produceEnd").val()=='') {
            alert("产品有效时间不能为空");
            return;
        }
        /*
        if ($("#refund").val()=='') {
            alert("产品支持不能为空");
            return;
        } */
        if ($("#mallId").val()=='') {
            alert("商家ID不能为空");
            return;
        }
        if ($("#summary").val()=='') {
            alert("产品简介不能为空");
            return;
        }
        
        var refunds =document.getElementsByName("refundx"); //获取checkbox的值
        var strrefunds="";
		for(i=0;i<refunds.length;i++){
			if (refunds[i].checked) {
				strrefunds+=refunds[i].value+",";
			}
		}
		//alert(strrefunds);
	//	$("#refund").val(strrefunds.replace(/,$/g,""));  //去掉最后一个，号

		if ($("#file").val() !== "") {
			$.ajaxFileUpload({
				url : '${path}/conf/upload',
				secureuri : false,
				fileElementId : 'file',
				dataType : 'json',
				success : function(data, status) {
					if (data.statusCode == 200) {
						$("#imgUrl").val(data.uri);
						$("#form").submit();
					} else
						alert(data.info);
				}
			});
		} else {
			$("#form").submit();
		}

	}
    $('#myTab li:eq(1) a').tab('show');  ///////选择卡

  //弹出图片上传的对话框
    function upImage()
    {
    	
     var myImage = o_ueditorupload.getDialog("insertimage");
      myImage.open();
    }
    //弹出文件上传的对话框
    function upFiles()
    {
    	  var myFiles = o_ueditorupload.getDialog("attachment");
      myFiles.open();
    } 

    function   dels(em)
    {
    	 var uel=$(em).attr("el"); 
    	  $(".imgs").each(function(){
    		  if($(this).attr("sr")==uel){
    			  $(this).hide();
    		  }
    	  });
    
    	  var start = $("#productximg").val();
    	  start = start.replace(uel+",",'');
     	  $("#productximg").val(start);
    	  $(em).hide();
    }
    function   opendxs(em)
    {

     if($(em).val()==1){
    	 $("#dxs").show();
    	  	 $("#mallId").val("3");

     }else{
    	 $("#dxs").hide();
	  	 $("#mallId").val("2");
     }
    }
    function   opendxzzz(em){
    	  if($(em).val()==0){
    	    	 $("#reduceprice").val("298");
    	     }else if($(em).val()==1){
    	    	 $("#reduceprice").val("980");
    	     }
    }
</script>
</body>
</html>